import 'package:equatable/equatable.dart';
import 'package:floor/floor.dart';
import 'package:flutter/material.dart';

@DatabaseView(
    'SELECT step.step, step.calories, step.distance, hr.rate as heart_rate, sleep.sleep_time, step.calendar, step.address '
        'FROM step '
        'LEFT JOIN sleep ON step.address=sleep.address '
        'LEFT JOIN heart_rate hr ON step.address=hr.address',
    viewName: 'weekly_report')

@immutable
class WeeklyReportModel extends Equatable {
  /// 手表mac地址
  final String? address;

  /// 日期，格式 ：yyyyMMdd
  final String? calendar;

  /// 运动步数，最小计步单位为1步
  final int? step;

  /// 运动卡路里消耗值，单位：千卡
  final double? calories;

  /// 运动距离，单位：米
  final int? distance;

  /// 心率
  @ColumnInfo(name: 'heart_rate')
  final int? heartRate;

  /// 睡眠时长
  @ColumnInfo(name: 'sleep_time')
  final int? sleepTime;

  const WeeklyReportModel(this.address, this.calendar, this.step, this.calories, this.distance, this.heartRate, this.sleepTime);

  @override
  List<Object?> get props => [calendar, step, calories, distance, heartRate, sleepTime];

  @override
  bool? get stringify => true;
}
